import { devQueryInfos, devReSubmit } from '../services/api';

export default {
    namespace: 'devreport',

    state: {
        devlist: ['init'],
    },

    effects: {
        *fetch({ payload }, { call, put }) {
            const response = yield call(devQueryInfos, payload);
            const result = response.devQueryInfos;
            //console.log('log', result);
            yield put({
                type: 'save',
                payload: result,
            });
        },
        *submit({ payload, callback }, { call, put }) {
            const response = yield call(devReSubmit, payload);
            // console.log('response', response);
            if (response ?.result ?.code === 1000) callback();
        },
    },

    reducers: {
        save(state, action) {
            return {
                devlist: action.payload,
            };
        },
    },
};
